<extend name="Bbs/base"/>
<block name="crumb">
    <ol class="bbs-left crumb">
        <li><a href="{:U('/org/'.$org['id'])}">{$org.name}</a></li>
        <li><a href="{:U('/bbs/'.$org['id'])}"> BBS </a></li>
        <span>...</span>
    </ol>
</block>
<block name="bbs">
    <div class="bbs-left">
        <h1 class="tie-title"><if condition="$tie['top'] eq 1"><span class="art_top">顶置</span>&nbsp;</if><if condition="$tie['elite'] eq 1"><span class="art_elite">精</span>&nbsp;</if>{$tie.title}</h1>
        <div class="faq-div faq-header-div">
            <span class="faq-count">{$tie.reply}</span>
            <div class="faq-content">
                <div class="wooo">
                    {$tie.html}
                </div>
                <p class="faq-msg" data-tid="{$tie.id}"><a href="{:U('/u/'.$tie['uid'])}">{$tie.nick}</a>&nbsp;&nbsp;<php>if($tmp==date('Ymd',$tie['create'])){echo date('H:i:s',$tie['create']);}else{echo date('Y-m-d',$tie['create']);}</php>&nbsp;&nbsp;<a href="#book-comment">评论</a><if condition="$tie['uid'] eq UID">&nbsp;&nbsp;<a href="javascript:void(0)" class="replenishQ">补充</a></if>
                    <if condition="$manager">
                        &nbsp;&nbsp;<a href="javascript:void(0)" id="deleteTie">删除</a>
                        <php>
                            if($super){
                                if($tie['elite'] == 1){
                                    echo '&nbsp;&nbsp;<a href="javascript:void(0)" id="cancelElite">取消精华{$tie.elite}</a>';
                                }else{
                                    echo '&nbsp;&nbsp;<a href="javascript:void(0)" id="setElite">设为精华</a>';
                                }
                                if($tie['top'] == 1){
                                    echo '&nbsp;&nbsp;<a href="javascript:void(0)" id="cancelTop">取消顶置</a>';
                                }else{
                                    echo '&nbsp;&nbsp;<a href="javascript:void(0)" id="setTop">设为顶置</a>';
                                }
                            }
                        </php>
                    </if>
                </p>
            </div>
        </div>
        <if condition="$tie['uid'] eq UID">
            <div class="book-comment hide edit-q">
                <h2>补充说明</h2>
                <form action="{:U('/bbs/publishpatch')}" method="POST" class="form" id="patchForm">
                    <div class="form-item form-md">
                        <input type="hidden" name="tid" value="{$tie.id}">
                        <input type="hidden" name="html" id="patchHtml" class="resContent" value="">
                        <textarea class="formContent" id="patchMd" spellcheck="false" tabindex="1" placeholder="补充说明将合并显示到内容最后..." required="required"></textarea>
                        <p></p>
                        <div class="md-preview wooo"></div>
                    </div>
                    <div class="form-item form-button clearfix">
                        <p class="sendTip"></p>
                        <button class="md-button" tabindex="2" id="patchBtn">提交补充.</button>
                    </div>
                </form>
            </div>
        </if>
        <div class="answer">
            <div class="answer-count">{$count} 个回答</div>
            <ul class="answer-content" id="ansSec">
                <if condition="$list">
                    <volist name="list" id="vo">
                        <li class="faq-div" id="ans{$vo.id}" data-aid="{$vo.id}" data-auid="{$vo.uid}" data-reply="{$vo.reply}">
                            <a href="javascript:void(0)" class="faq-count" id="ansReply{$vo.id}">{$vo.reply}</a>
                            <div class="faq-content">
                                <div class="wooo">
                                    {$vo.html}
                                </div>
                                <p class="faq-msg" data-aid="{$vo.id}">
                                    <a href="{:U('/u/'.$vo['uid'])}">{$vo.nick}</a>&nbsp;&nbsp;<php>if($tmp==date('Ymd',$vo['create'])){echo date('H:i:s',$vo['create']);}else{echo date('Y-m-d',$vo['create']);}</php>&nbsp;&nbsp;<a href="javascript:void(0)" data-type="1" class="reply" id="replyBtn{$vo.id}">评论</a><if condition="$vo['uid'] eq UID">&nbsp;&nbsp;<a href="javascript:void(0)" data-type="2" class="reply">补充</a></if><if condition="$manager">&nbsp;&nbsp;<a href="javascript:void(0)" class="delAnsBtn">删除</a></if>
                                </p>
                            </div>
                        </li>
                    </volist>
                    <else />
                    <li class="faq-div">
                        <p class="no-msg">暂无回答...</p>
                    </li>
                </if>
                {$page}
            </ul>
        </div>
        <div class="book-comment edit-a" id="book-comment">
            <h2>撰写答案</h2>
            <form action="{:U('/tie/publish')}" method="POST" class="form faq" id="form">
                <input type="hidden" name="tid" value="{$tie.id}">
                <input type="hidden" name="html" id="htmlContent">
                <div class="form-item form-md">
                    <div class="md-tools clearfix hide" id="contentNav">
                        <a href="javascript:void(0)" id="imgBtn"><span class="icon-img"></span></a>
                        <a href="javascript:void(0)" id="helpBtn"><span class="icon-help"></span></a>
                        <a href="javascript:void(0)" id="previewBtn" class="right"><span class="icon-eye"></span></a>
                        <!-- <a href="javascript:void(0)" id="full" class="right"><span class="icon-full"></span></a> -->
                    </div>
                    <textarea id="content" spellcheck="false" tabindex="2"></textarea>
                    <p></p>
                    <div class="md-preview wooo" id="shadeSec"></div>
                </div>
                <div class="form-item form-button clearfix hide" id="submitSec">
                    <p class="sendTip">祝你每天愉悦好心情!</p>
                    <button class="md-button" id="submitBtn">提交回答</button>
                </div>
            </form>
        </div>
    </div>
</block>
<block name="js">
    <script>
        var token = "{$token}", uid = {:UID}, oid = {$org.id}, tid = {$tie.id}, username = "{$user.nick}", manager = {$manager};
    </script>
    <script src="__STATIC__/doc/js/tie.js?v=__VERSION__"></script>
</block>